package com.imti.mall.product.mapper;

import com.imti.mall.model.pms.pojo.PmsMemberPrice;
import org.apache.ibatis.jdbc.SQL;

public class PmsMemberPriceDynaSqlProvider {
    /**
     * 根据id修改会员
     * @param pmsMemberPrice
     * @return
     */
    public String updatePmsMemberPrice(final PmsMemberPrice pmsMemberPrice){
        return new SQL(){
            {
                UPDATE(" pms_member_price ");
                if(pmsMemberPrice!=null){
                    if (pmsMemberPrice.getProductId() != null) {
                        SET("  product_id=#{productId}");
                    }
                    if (pmsMemberPrice.getMemberLevelId() != null) {
                        SET("  member_level_id=#{memberLevelId}");
                    }
                    if (pmsMemberPrice.getMemberPrice() != null) {
                        SET("  member_price=#{memberPrice}");
                    }
                    if (pmsMemberPrice.getMemberLevelName() != null) {
                        SET(" member_level_name=#{memberLevelName}");
                    }
                }
                WHERE(" id=#{id} ");
            }

        }.toString();

    }
}
